#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include <arpa/inet.h>

extern void client_start();

void client_start()
{

    int sock = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);

    struct sockaddr_in serv_addr;
    memset(&serv_addr, 0, sizeof(serv_addr));

    serv_addr.sin_family = AF_INET;
    serv_addr.sin_addr.s_addr = inet_addr("127.0.0.1");
    serv_addr.sin_port = htons(1234);
    connect(sock, (struct sockaddr*)&serv_addr, sizeof(serv_addr));
    char buff[255];
   // while (fgets(buff, 255, sock) != NULL){
    //}
    //printf("%s", "smessage form server:");
    int fd = 0;
    while (1){
        //int ss = recv(fd, buff, sizeof(buff), 0);
        read(sock, buff, sizeof(buff));
//        fgets(buff, sizeof(buff), (FILE*)sock);
        printf("%s", buff);
    }
    //close(sock);

}